package org.giovanolli.mumi.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * The Class PatientPrepaid.
 */
@Entity
@Table(name = "patient_prepaid")
public class PatientPrepaid extends IdentificableEntity {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -6689536363537542488L;

	/** The patient. */
	@ManyToOne
	@JoinColumn(name = "patient_id", updatable = false, insertable = false, nullable = false)
	private Patient patient;

	/** The prepaid. */
	@ManyToOne
	@JoinColumn(name = "prepaid_id")
	private Prepaid prepaid;

	/** The associate number. */
	@Column(name = "associate_number")
	private String associateNumber;

	/** The expiration date. */
	@Column(name = "expiration_date")
	private String expirationDate;

	/**
	 * Gets the associate number.
	 * 
	 * @return the associate number
	 */
	public String getAssociateNumber() {
		return associateNumber;
	}

	/**
	 * Gets the description.
	 * 
	 * @return the description
	 */
	@Transient
	public String getDescription() {
		return prepaid.getName() + " (Afiliado " + associateNumber + " Venc. " + expirationDate + ")";
	}

	/**
	 * Gets the expiration date.
	 * 
	 * @return the expiration date
	 */
	public String getExpirationDate() {
		return expirationDate;
	}

	/**
	 * Gets the patient.
	 * 
	 * @return the patient
	 */
	public Patient getPatient() {
		return patient;
	}

	/**
	 * Gets the prepaid.
	 * 
	 * @return the prepaid
	 */
	public Prepaid getPrepaid() {
		return prepaid;
	}

	/**
	 * Sets the associate number.
	 * 
	 * @param associateNumber
	 *            the new associate number
	 */
	public void setAssociateNumber(String associateNumber) {
		this.associateNumber = associateNumber;
	}

	/**
	 * Sets the expiration date.
	 * 
	 * @param expirationDate
	 *            the new expiration date
	 */
	public void setExpirationDate(String expirationDate) {
		this.expirationDate = expirationDate;
	}

	/**
	 * Sets the patient.
	 * 
	 * @param patient
	 *            the new patient
	 */
	public void setPatient(Patient patient) {
		this.patient = patient;
	}

	/**
	 * Sets the prepaid.
	 * 
	 * @param prepaid
	 *            the new prepaid
	 */
	public void setPrepaid(Prepaid prepaid) {
		this.prepaid = prepaid;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.osoftware.mumi.dao.model.BaseObject#toString()
	 */
	@Override
	public String toString() {
		return "PatientPrepaid [patient=" + patient + ", prepaid=" + prepaid + ", toString()=" + super.toString() + "]";
	}

}
